home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / UserList.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  6KB  |  179 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.4)
  3.  
  4. '''A more or less complete user-defined wrapper around list objects.'''
  5.  
  6. class UserList:
  7.     
  8.     def __init__(self, initlist = None):
  9.         self.data = []
  10.         if initlist is not None:
  11.             if type(initlist) == type(self.data):
  12.                 self.data[:] = initlist
  13.             elif isinstance(initlist, UserList):
  14.                 self.data[:] = initlist.data[:]
  15.             else:
  16.                 self.data = list(initlist)
  17.         
  18.  
  19.     
  20.     def __repr__(self):
  21.         return repr(self.data)
  22.  
  23.     
  24.     def __lt__(self, other):
  25.         return self.data < self._UserList__cast(other)
  26.  
  27.     
  28.     def __le__(self, other):
  29.         return self.data <= self._UserList__cast(other)
  30.  
  31.     
  32.     def __eq__(self, other):
  33.         return self.data == self._UserList__cast(other)
  34.  
  35.     
  36.     def __ne__(self, other):
  37.         return self.data != self._UserList__cast(other)
  38.  
  39.     
  40.     def __gt__(self, other):
  41.         return self.data > self._UserList__cast(other)
  42.  
  43.     
  44.     def __ge__(self, other):
  45.         return self.data >= self._UserList__cast(other)
  46.  
  47.     
  48.     def __cast(self, other):
  49.         if isinstance(other, UserList):
  50.             return other.data
  51.         else:
  52.             return other
  53.  
  54.     
  55.     def __cmp__(self, other):
  56.         return cmp(self.data, self._UserList__cast(other))
  57.  
  58.     
  59.     def __contains__(self, item):
  60.         return item in self.data
  61.  
  62.     
  63.     def __len__(self):
  64.         return len(self.data)
  65.  
  66.     
  67.     def __getitem__(self, i):
  68.         return self.data[i]
  69.  
  70.     
  71.     def __setitem__(self, i, item):
  72.         self.data[i] = item
  73.  
  74.     
  75.     def __delitem__(self, i):
  76.         del self.data[i]
  77.  
  78.     
  79.     def __getslice__(self, i, j):
  80.         i = max(i, 0)
  81.         j = max(j, 0)
  82.         return self.__class__(self.data[i:j])
  83.  
  84.     
  85.     def __setslice__(self, i, j, other):
  86.         i = max(i, 0)
  87.         j = max(j, 0)
  88.         if isinstance(other, UserList):
  89.             self.data[i:j] = other.data
  90.         elif isinstance(other, type(self.data)):
  91.             self.data[i:j] = other
  92.         else:
  93.             self.data[i:j] = list(other)
  94.  
  95.     
  96.     def __delslice__(self, i, j):
  97.         i = max(i, 0)
  98.         j = max(j, 0)
  99.         del self.data[i:j]
  100.  
  101.     
  102.     def __add__(self, other):
  103.         if isinstance(other, UserList):
  104.             return self.__class__(self.data + other.data)
  105.         elif isinstance(other, type(self.data)):
  106.             return self.__class__(self.data + other)
  107.         else:
  108.             return self.__class__(self.data + list(other))
  109.  
  110.     
  111.     def __radd__(self, other):
  112.         if isinstance(other, UserList):
  113.             return self.__class__(other.data + self.data)
  114.         elif isinstance(other, type(self.data)):
  115.             return self.__class__(other + self.data)
  116.         else:
  117.             return self.__class__(list(other) + self.data)
  118.  
  119.     
  120.     def __iadd__(self, other):
  121.         if isinstance(other, UserList):
  122.             self.data += other.data
  123.         elif isinstance(other, type(self.data)):
  124.             self.data += other
  125.         else:
  126.             self.data += list(other)
  127.         return self
  128.  
  129.     
  130.     def __mul__(self, n):
  131.         return self.__class__(self.data * n)
  132.  
  133.     __rmul__ = __mul__
  134.     
  135.     def __imul__(self, n):
  136.         self.data *= n
  137.         return self
  138.  
  139.     
  140.     def append(self, item):
  141.         self.data.append(item)
  142.  
  143.     
  144.     def insert(self, i, item):
  145.         self.data.insert(i, item)
  146.  
  147.     
  148.     def pop(self, i = -1):
  149.         return self.data.pop(i)
  150.  
  151.     
  152.     def remove(self, item):
  153.         self.data.remove(item)
  154.  
  155.     
  156.     def count(self, item):
  157.         return self.data.count(item)
  158.  
  159.     
  160.     def index(self, item, *args):
  161.         return self.data.index(item, *args)
  162.  
  163.     
  164.     def reverse(self):
  165.         self.data.reverse()
  166.  
  167.     
  168.     def sort(self, *args, **kwds):
  169.         self.data.sort(*args, **kwds)
  170.  
  171.     
  172.     def extend(self, other):
  173.         if isinstance(other, UserList):
  174.             self.data.extend(other.data)
  175.         else:
  176.             self.data.extend(other)
  177.  
  178.  
  179.